#include<bits/stdc++.h>
using namespace std;
const int N = 2e5;

int n, a[N + 2];

void solve()
{
    cin >> n;
    int s = 0, ok = 1;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        if (abs(a[i]) != abs(a[1])) ok = 0;
        if (a[i] < 0) s--;else s++;
    }
    if (ok) {
        if (s == -n || abs(s) <= 1 || s == n)  cout << "Yes\n"; else cout << "No\n";
        return;
    } else {
        sort(a + 1, a + n + 1, [](int x, int y) { return abs(x) < abs(y); });
        for (int i = 2; i + 1 <= n; ++i) if (a[i] * a[i] != a[i - 1] * a[i + 1]) { cout << "No\n";return; }
        cout << "Yes\n";
    }
}

int main() {
    // #ifndef ONLINE_JUDGE
    //     std::istringstream in(R"()");
    //     std::cin.rdbuf(in.rdbuf());
    // #endif
    int T; cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}